<?php

namespace app\common\model;

use think\Model;


class MemberCategory extends Model
{

    

    

    // 表名
    protected $table = 'member_category';
    
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = false;

    // 定义时间戳字段名
    protected $createTime = false;
    protected $updateTime = false;
    protected $deleteTime = false;

    // 追加属性
    protected $append = [

    ];



    public function parent()
    {
        return $this->belongsTo('app\common\model\MemberCategory', 'pid', 'id', [], 'LEFT');
    }


    public function getParentList()
    {
        return (new MemberCategory())->where(['pid' => 0])->column('name','id');
    }




}
